const userDataMethods = {
    methods: {
        getUserData({ suc, err, fail }) {
            let url = window.tools.getAdminUrl('manager/userData');
            this.apiPost(url, {}).then((res) => {
                this.isLogin = false;
                if (res.code == 1) {
                    window.Lockr.set('menuList', res.data.menuList);
                    window.Lockr.set('userInfo', res.data.userInfo);
                    if (typeof suc === 'function') {
                        suc.bind(this)(res);
                    }
                } else if (res.code == 0) {
                    if (typeof err === 'function') {
                        err.bind(this)(res);
                    }
                } else {
                    if (typeof fail === 'function') {
                        fail.bind(this)(res);
                    } else {
                        this.handleError(res);
                    }
                }
            });
        }
    }
};

export default userDataMethods;